package com.google.code.whitetask.old;

public enum TaskResultType {
  SUCCESS, FAILURE, FAILOVER, STOPPED, DELEGATION;

  static boolean isSuccess(TaskResultType result) {
    return result == SUCCESS || result == FAILOVER || result == DELEGATION;
  }

  public static void validateTaskResult(Task task, TaskResultType result) {
    if (TaskResultType.isSuccess(result) == false) {
      throw new FailedTaskException(task.getClass().getName()
          + " task is failed. Result is " + result);
    }
  }
}
